home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / miscpas.zip / SPOKES.PAS < prev    next >
Pascal/Delphi Source File  |  1984-06-12  |  911b  |  37 lines

  1. Program Spokes;
  2.  
  3. {  A simple graphics demonstration using the hires screen.  This program  }
  4. {  uses the external function LINE.INV which must reside on the default   }
  5. {  drive in order to compile the program.   Jeff Firestone  June, 1984.   }
  6.  
  7. Var
  8.   v, h, s, c, angle, radians : real;
  9.   n, x, y, sx, sy, cx, cy : integer;
  10.  
  11.  
  12. Procedure Line(a,b,c,d,e:integer); External 'Line.INV';
  13.  
  14.  
  15. begin
  16.   Write('Number of spokes on wheel : ');
  17.   read(n); writeln;
  18.   write('Size (245) : ');
  19.   read(h); writeln;
  20.   v:= h * 0.4;
  21.   s:= 280;
  22.   c:= 100;
  23.   angle:= 360 / n;
  24.   radians:= angle / 57.29578;
  25.   hires; hiresColor(7);
  26.   for x:= 1 to n do
  27.   for y:= x to n do
  28.   begin
  29.     sx:= round(sin(x * radians) * h + s);
  30.     sy:= round(sin(y * radians) * h + s);
  31.     cx:= round(cos(x * radians) * v + c);
  32.     cy:= round(cos(y * radians) * v + c);
  33.     line(sy, cy, sx, cx, 1);
  34.   end;
  35.   readln;
  36. end.
  37.